package xyz.playedu.resource.domain;

import lombok.Data;
import xyz.playedu.common.util.StringUtil;

import java.util.ArrayList;
import java.util.List;

@Data
public class ResourceTextNode {
    private String  nodeName;
    private String  elementId;
    private String  elmentType;
    private String  htmlContent;
    private List<ResourceTextNode> children=new ArrayList<>();
    private boolean isRoot=true;
    public int getElementNum(){
        if(StringUtil.isEmpty(elmentType)){
            elmentType = "h1";
        }
        String num = elmentType.replace("h","");
        if(StringUtil.isEmpty(num)){
            return 1;
        }
        return Integer.parseInt(num);
    }
}
